package com.baidumap.administrator.happystudy.model;

import com.ab.util.AbJsonUtil;

import java.util.List;

/**
 * 描述：
 * 作者：xiaoxing on 17/4/11 21:17
 * 邮箱：2235445233@qq.com
 */
public class TeacherIndex {


    /**
     * code : 200
     * msg : success
     * data : [{"teacher_id":"11","teacher_pic":"/Uploads/2017-01-17/587e38c2aba63.jpg","name":"李华","area":"深圳","school_name":"深圳大学","section":"计算机科学","grade":"大2","questions":"10","rank":"1","income":"300.00"},{"teacher_id":"13","teacher_pic":null,"name":"陈武","area":"安徽","school_name":"安徽大学","section":"量子物理","grade":"大1","questions":"15","rank":"2","income":"256.00"}]
     */

    private String code;
    private String msg;
    private List<DataBean> data;


    /**
     * 用json构造自己
     *
     * @param json
     */
    public TeacherIndex(String json) {
        TeacherIndex result = AbJsonUtil.fromJson(json, this.getClass());
        this.code = result.getCode();
        this.msg = result.getMsg();
        this.data = result.getData();

    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    @Override
    public boolean equals(Object obj) {
        TeacherIndex teacherIndex = (TeacherIndex) obj;
        return code.equals(teacherIndex.code) &&
                msg.equals(teacherIndex.msg) &&
                data.equals(teacherIndex.data);
    }

    @Override
    public int hashCode() {
        String in = code + msg + data;
        return in.hashCode();
    }

    public static class DataBean {
        /**
         * teacher_id : 11
         * teacher_pic : /Uploads/2017-01-17/587e38c2aba63.jpg
         * name : 李华
         * area : 深圳
         * school_name : 深圳大学
         * section : 计算机科学
         * grade : 大2
         * questions : 10
         * rank : 1
         * income : 300.00
         */

        private String teacher_id;
        private String teacher_pic;
        private String name;
        private String area;
        private String school_name;
        private String section;
        private String grade;
        private String questions;
        private String rank;
        private String income;

        @Override
        public boolean equals(Object obj) {
            DataBean dataBean = (DataBean) obj;
            return teacher_id.equals(dataBean.teacher_id) ;
//                    &&
//                    teacher_pic.equals(dataBean.teacher_pic) &&
//                    name.equals(dataBean.name) &&
//                    area.equals(dataBean.area) &&
//                    school_name.equals(dataBean.school_name) &&
//                    section.equals(dataBean.section) &&
//                    grade.equals(dataBean.grade) &&
//                    questions.equals(dataBean.questions) &&
//                    rank.equals(dataBean.rank) &&
//                    income.equals(dataBean.income
//                    );
        }

        @Override
        public int hashCode() {
//            String in = teacher_id + teacher_pic + name + area + school_name + section + grade + questions + rank + income;
            String in = teacher_id ;
            return in.hashCode();
        }


        public String getTeacher_id() {
            return teacher_id;
        }

        public void setTeacher_id(String teacher_id) {
            this.teacher_id = teacher_id;
        }

        public String getTeacher_pic() {
            return teacher_pic;
        }

        public void setTeacher_pic(String teacher_pic) {
            this.teacher_pic = teacher_pic;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getArea() {
            return area;
        }

        public void setArea(String area) {
            this.area = area;
        }

        public String getSchool_name() {
            return school_name;
        }

        public void setSchool_name(String school_name) {
            this.school_name = school_name;
        }

        public String getSection() {
            return section;
        }

        public void setSection(String section) {
            this.section = section;
        }

        public String getGrade() {
            return grade;
        }

        public void setGrade(String grade) {
            this.grade = grade;
        }

        public String getQuestions() {
            return questions;
        }

        public void setQuestions(String questions) {
            this.questions = questions;
        }

        public String getRank() {
            return rank;
        }

        public void setRank(String rank) {
            this.rank = rank;
        }

        public String getIncome() {
            return income;
        }

        public void setIncome(String income) {
            this.income = income;
        }
    }
}
